// let moment = require("moment");
import moment from 'moment'

moment.locale("zh-cn");

const filterTimes = (val, format = "YYYY-MM-DD") => {
  if (!isNull(val)) {
    if (val.length == 10) {
      val = parseInt(val) * 1000;
    }
    return moment(val).format(format);
  } else {
    return "--";
  }
};
// 非空校验
export function isNull(data) {
  if (!data) return true;
  if (JSON.stringify(data) === "{}") return true;
  if (JSON.stringify(data) === "[]") return true;
}

export default (app) => {
  app.config.globalProperties.$filterTimes = filterTimes;
};


/* {<el-table-column label="create_time" width="150">
<template v-slot="{ row }">
  {{ $filterTimes(row.create_time) }}
</template>
</el-table-column> }*/
